<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>设备管理</el-breadcrumb-item>
      <el-breadcrumb-item>设备信息总览</el-breadcrumb-item>
    </el-breadcrumb>
    <div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">温度传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi">
              Temperature sensor
            </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-odometer"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ wenduzongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">湿度传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi">
              Humidity sensor
            </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-timer"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ shiduzongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">红外传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi">
              Infrared sensor
            </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-files"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ hongwaizongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">火焰传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi">
              Flame sensor
            </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-no-smoking"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ huoyanzongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">门磁传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi"> Door magnetic sensor </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-school"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ mencizongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
      <div>
        <el-form class="Decice_box">
          <el-form class="Decice_box1">
            <span class="Decice_box1wenzi">光线传感器</span>
            <span class="Decice_box1wenzi">__</span>
            <span class="Decice_box1fanyi"> Light sensor </span>
          </el-form>
          <el-form class="Decice_box2">
            <i style="font-size: 90px;" class="el-icon-magic-stick"></i>
            <el-form class="Decice_box2neirong">
              <span class="Decice_box2wenzi">设备总数量：</span>
              <p class="Decice_box2wenzi">{{ guangxianzongliang }}</p>
            </el-form>
          </el-form>
          <el-form class="Decice_box3">
            <span class="Decice_box3wenzi">异常设备总量:</span>
            <p class="Decice_box3wenzi">{{ yichangshebeishuliang }}</p>
          </el-form>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      wenduzongliang: 0,
      hongwaizongliang: 0,
      huoyanzongliang: 0,
      mencizongliang: 0,
      guangxianzongliang: 0,
      yichangshebeishuliang: 0,
      shiduzongliang: 0,
      shidu: '湿度传感器',
      wendu: '温度传感器',
      hongwai: '红外传感器',
      huoyan: '火焰传感器',
      menci: '门磁传感器',
      guanxian: '光线传感器'
    }
  },
  created() {
    this.getUserList()
  },
  methods: {
    getUserList() {
      this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.wendu
        })
        .then(response => {
          console.log(response.data[0].count)
          this.wenduzongliang = response.data[0].count
        })
        this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.shidu
        })
        .then(response => {
          this.shiduzongliang = response.data[0].count
        })
      this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.hongwai
        })
        .then(response => {
          this.hongwaizongliang = response.data[0].count
        })
      this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.huoyan
        })
        .then(response => {
          this.huoyanzongliang = response.data[0].count
        })
      this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.menci
        })
        .then(response => {
          this.mencizongliang = response.data[0].count
        })
      this.$axios
        .post('http://localhost:3000/api/Stu/countshuliang', {
          sensor: this.guanxian
        })
        .then(response => {
          this.guangxianzongliang = response.data[0].count
        })
    }
  }
}
</script>

<style lang="less" scoped>
.Decice_box {
  width: 32%;
  height: 300px;
  background-color: #333744;
  border-radius: 10px;
  border: 1px solid #000000;
  float: left;
  margin: 5px;
  .Decice_box1 {
    width: 100%;
    height: 30px;
    border-bottom: 1px solid #eaeaea;
    padding: 10px 0 0 10px;
    .Decice_box1wenzi {
      font-size: 20px;
      font-family: 'Courier New', Courier, monospace;
      color: #eaeaea;
    }
    .Decice_box1fanyi {
      font-size: 10px;
      border-radius: 4px;
      color: #eaeaea;
    }
  }
  .Decice_box2 {
    height: 130px;
    background-color: #ffffff;
    margin: 5px;
    border-radius: 15px;
    padding: 25px 0 0 20px;
    .Decice_box2neirong {
      width: 72%;
      height: 100px;
      background-color: #333744;
      float: right;
      border-radius: 10px;
      margin: 5px;
    }
    .Decice_box2wenzi {
      font-size: 25px;
      font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande',
        'Lucida Sans Unicode', Geneva, Verdana, sans-serif;

      margin: 20px;
      color: #ffffff;
    }
  }
  .Decice_box3 {
    height: 80px;
    background-color: #ffffff;
    border-radius: 15px;
    margin: 5px;
    padding-top: 10px;
    .Decice_box3wenzi {
      font-size: 25px;
      font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande',
        'Lucida Sans Unicode', Geneva, Verdana, sans-serif;

      margin: 10px;
    }
  }
}
</style>
